<template>
  <div class="denglu">
    <button class="start" @click="dian()" :class="disable">登录</button>
    <div class="xieYi">
      <div class="xuan">
        <van-checkbox v-model="checked" icon-size="0.2rem"></van-checkbox>
      </div>
      <div class="content">
        <p>同意并遵守<span>《米忽悠用户协议》《米忽悠隐私政策》</span></p>
      </div>
    </div>
    <div class="problem">遇到问题？</div>
  </div>
</template>

<script>
import Link from '@/apis/api.js'
export default {
  props:["name","pwd"],
  data(){
    return{
      checked:true,
      disable:''
    }
  },
  methods: {
    dian(){
      console.log('触发点击事件');
      console.log("登录的name："+this.name);
      console.log("登录的pwd："+this.pwd);

      let usp = new URLSearchParams();
      usp.append('uname',this.name);
      usp.append('upwd',this.pwd);
      Link('/api/MiYoShe/user/denglu',"post",{},usp).then((ok) =>{
        console.log(ok.data.token);
        if(ok.data.data == 1){
          window.localStorage.setItem('token',ok.data.token);
          alert("登录成功！");
          this.$router.push('/wode');
        }
        else{
          alert('登录失败！');
        }
      })
    }
  },
}
</script>

<style scoped>
.denglu {
  height: 1.85rem;
  /* background-color: aqua; */
  padding: 0.3rem 0.15rem;
}
.denglu .start {
  width: 100%;
  height: 0.44rem;
  border: none;
  border-radius: 0.05rem;
  color: white;
  background-color: rgb(24,162,253);
}
.denglu .xieYi {
  padding: 0.15rem 0;
  min-height: 0.7rem;
  /* background-color: chartreuse; */
  display: flex;
}
.denglu .xieYi .xuan input {
  font-size: 0.24rem;
}
.denglu .content{
  padding-right: .1rem;
  padding-left: .03rem;
  font-size: .14rem;
}
.denglu .problem {
  text-align: center;
  color: rgb(105,105,105);
}
.denglu .content span{
  color: rgb(24,162,253);
}
</style>